import React, { Component } from 'react'
// //返回上一页这段代码
// import creatHistory from 'history/createHashHistory'
// //返回上一页这段代码
// const history = creatHistory();

import { createHashHistory } from 'history' 
//返回上一页这段代码
const history = createHashHistory();

export default class ListDetail extends Component {

    state = {
        Detaillist: [],
        list: [],
    }
    
    componentDidMount() {
        this.getlist();
    }
    getlist = () => {
        console.log(this.props.location.params);
    }
    //返回上一页这段代码
    goBackPage = () => {
        history.goBack();  
         
      }
    render() {
        return (
            <div className='listdetail'>
                <dl>
                <p onClick={this.goBackPage} className="p"> &lt; </p>

                    <dt>
                        {/* <p onClick={this.goBackPage} className="goBack"> &lt; </p> */}
                        <img src={this.props.location.params.img} alt='' />
                    </dt>
                    <dd>
                        <p>{this.props.location.params.title}</p>
                        <span>{this.props.location.params.type}</span>
                        <span>{this.props.location.params.time}</span>
                        <span>阅读 98</span>
                        <span>赞 39</span>
                    </dd>
                </dl>
            </div>
        )
    }
}
